/** @method useActionsData
 *  @description 获取动作函数的数据
 *  @return Array
 */
import { useEffect, useState } from 'react';
import services from '../services/api';

export default function useActionsData(...usageScopeLimit) {
  const [actions, setActions] = useState([]);

  useEffect(() => {
    services.fn.allList({ usageScopeLimit }).then(({ code, data }) => {
      if (code === '0') {
        setActions(data);
      }
    });
  }, []);

  return actions;
}
